package com.hspedu.hspliving.commodity.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.hspedu.common.valid.EnumValidate;
import com.hspedu.common.valid.SaveGroup;
import com.hspedu.common.valid.UpdateGroup;
import com.hspedu.common.valid.UpdateIsshowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 家居品牌
 *
 * @author hsp
 * @email hsp@gmail.com
 * @date 2025-07-17 12:32:55
 */
@Data
@TableName("commodity_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@TableId
	//分组验证
	@NotNull(message = "id不为空",groups = {UpdateGroup.class, UpdateIsshowGroup.class})
	@Null(message = "id为空",groups = {SaveGroup.class})
	private Long id;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空",groups = {SaveGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * logo
	 */
	@NotBlank(message = "logo不为空",groups = {SaveGroup.class})
	@URL(message = "logo不合法",groups = {SaveGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 说明
	 */
	private String description;
	/**
	 * 显示
	 */
	@NotNull(message = "显示不能为空",groups = {SaveGroup.class,UpdateGroup.class,UpdateIsshowGroup.class})
	@EnumValidate(values = {0,1}, groups = {SaveGroup.class, UpdateGroup.class,UpdateIsshowGroup.class} )
	private Integer isshow;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "首字母必须填写",groups = {SaveGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "首字母必须 a-z 或者 A-Z 之间",groups = {SaveGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序不能为空",groups = {SaveGroup.class})
	@Min(value = 0,message = "排序必须>=0",groups = {SaveGroup.class,UpdateGroup.class})
	private Integer sort;

}
